Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix .change_resolution(sym=False) for FourierRZToroidalSurface, ZernikeRZToroidalSection and FourierRZCurve #1593

Merged
merged 10 commits into from
Feb 21, 2025

Conversation

dpanici
Copy link
Collaborator

@dpanici dpanici commented Feb 17, 2025

when only sym is passed into change_resolution, the underlying basis sym was not being correctly updated, which resulted in some bugs when dealing with asymmetric equilibria.

Resolves #1586

@dpanici dpanici requested review from a team, rahulgaur104, f0uriest, ddudt, sinaatalay, unalmis and YigitElma and removed request for a team February 17, 2025 20:00
Copy link
Contributor

github-actions bot commented Feb 17, 2025

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_midres         |     +2.37 +/- 6.78     | +1.51e-02 +/- 4.32e-02 |  6.53e-01 +/- 2.5e-02  |  6.38e-01 +/- 3.5e-02  |
 test_build_transform_fft_highres        |     +1.90 +/- 5.88     | +1.77e-02 +/- 5.46e-02 |  9.46e-01 +/- 5.3e-02  |  9.28e-01 +/- 1.2e-02  |
 test_equilibrium_init_lowres            |     -0.89 +/- 3.52     | -3.66e-02 +/- 1.45e-01 |  4.08e+00 +/- 5.8e-02  |  4.12e+00 +/- 1.3e-01  |
 test_objective_compile_atf              |     +1.38 +/- 3.19     | +1.15e-01 +/- 2.65e-01 |  8.43e+00 +/- 1.9e-01  |  8.31e+00 +/- 1.8e-01  |
 test_objective_compute_atf              |     -2.42 +/- 4.63     | -4.09e-04 +/- 7.81e-04 |  1.65e-02 +/- 4.9e-04  |  1.69e-02 +/- 6.1e-04  |
 test_objective_jac_atf                  |     +0.00 +/- 1.53     | +1.05e-05 +/- 3.02e-02 |  1.98e+00 +/- 2.2e-02  |  1.98e+00 +/- 2.0e-02  |
 test_perturb_1                          |     +0.22 +/- 0.96     | +3.43e-02 +/- 1.47e-01 |  1.53e+01 +/- 1.2e-01  |  1.53e+01 +/- 8.9e-02  |
 test_proximal_jac_atf                   |     -0.16 +/- 1.29     | -1.30e-02 +/- 1.04e-01 |  8.07e+00 +/- 7.6e-02  |  8.08e+00 +/- 7.1e-02  |
 test_proximal_freeb_compute             |     +0.34 +/- 1.83     | +7.33e-04 +/- 3.93e-03 |  2.15e-01 +/- 1.5e-03  |  2.14e-01 +/- 3.6e-03  |
 test_solve_fixed_iter                   |     +0.83 +/- 1.66     | +2.72e-01 +/- 5.46e-01 |  3.32e+01 +/- 4.5e-01  |  3.29e+01 +/- 3.1e-01  |
 test_objective_compute_ripple           |     +0.68 +/- 2.88     | +4.72e-03 +/- 2.00e-02 |  6.99e-01 +/- 1.0e-02  |  6.94e-01 +/- 1.7e-02  |
 test_objective_grad_ripple              |     +0.12 +/- 1.68     | +3.17e-03 +/- 4.46e-02 |  2.66e+00 +/- 1.9e-02  |  2.66e+00 +/- 4.0e-02  |
 test_build_transform_fft_lowres         |     +4.61 +/- 5.68     | +2.88e-02 +/- 3.55e-02 |  6.53e-01 +/- 2.3e-02  |  6.25e-01 +/- 2.7e-02  |
 test_equilibrium_init_medres            |     -0.01 +/- 3.39     | -5.25e-04 +/- 1.49e-01 |  4.39e+00 +/- 1.3e-01  |  4.39e+00 +/- 6.9e-02  |
 test_equilibrium_init_highres           |     -0.17 +/- 2.73     | -9.19e-03 +/- 1.46e-01 |  5.35e+00 +/- 1.3e-01  |  5.36e+00 +/- 7.3e-02  |
 test_objective_compile_dshape_current   |     +1.20 +/- 4.37     | +5.07e-02 +/- 1.85e-01 |  4.28e+00 +/- 1.3e-01  |  4.23e+00 +/- 1.4e-01  |
 test_objective_compute_dshape_current   |     +0.76 +/- 2.90     | +4.13e-05 +/- 1.58e-04 |  5.49e-03 +/- 7.3e-05  |  5.45e-03 +/- 1.4e-04  |
 test_objective_jac_dshape_current       |     +0.67 +/- 7.72     | +2.89e-04 +/- 3.32e-03 |  4.34e-02 +/- 1.9e-03  |  4.31e-02 +/- 2.7e-03  |
 test_perturb_2                          |     -0.00 +/- 2.04     | -3.26e-04 +/- 4.21e-01 |  2.07e+01 +/- 3.1e-01  |  2.07e+01 +/- 2.8e-01  |
 test_proximal_jac_atf_with_eq_update    |     -1.31 +/- 1.07     | -2.26e-01 +/- 1.84e-01 |  1.71e+01 +/- 8.4e-02  |  1.73e+01 +/- 1.6e-01  |
 test_proximal_freeb_jac                 |     +0.36 +/- 4.29     | +2.55e-02 +/- 3.07e-01 |  7.19e+00 +/- 3.0e-01  |  7.16e+00 +/- 4.6e-02  |
 test_solve_fixed_iter_compiled          |     +0.22 +/- 0.51     | +4.75e-02 +/- 1.09e-01 |  2.13e+01 +/- 9.9e-02  |  2.12e+01 +/- 4.4e-02  |
 test_LinearConstraintProjection_build   |     +0.06 +/- 3.45     | +6.69e-03 +/- 3.94e-01 |  1.14e+01 +/- 2.9e-01  |  1.14e+01 +/- 2.6e-01  |
 test_objective_compute_ripple_spline    |     -0.14 +/- 3.43     | -5.03e-04 +/- 1.20e-02 |  3.49e-01 +/- 5.8e-03  |  3.49e-01 +/- 1.0e-02  |
 test_objective_grad_ripple_spline       |     +1.83 +/- 2.46     | +2.60e-02 +/- 3.51e-02 |  1.45e+00 +/- 2.0e-02  |  1.42e+00 +/- 2.9e-02  |

@YigitElma
Copy link
Collaborator

@dpanici test_equilibrium_from_near_axis is failing due to some extra modes. I think it was previously symmetric and now not, so the compared modes are not the same. Is this something to do with the pickle file or .from_near_axis?

@YigitElma
Copy link
Collaborator

@dpanici test_equilibrium_from_near_axis is failing due to some extra modes. I think it was previously symmetric and now not, so the compared modes are not the same. Is this something to do with the pickle file or .from_near_axis?

This should solve the indexing,

np.testing.assert_allclose(
    eq.Ra_n[len(eq.Ra_n) // 2 : len(eq.Ra_n) // 2 + 2], na.rc, atol=1e-10
)
np.testing.assert_allclose(
    eq.Za_n[len(eq.Za_n) // 2 - 2 : len(eq.Za_n) // 2], na.zs, atol=1e-10
)

Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.69%. Comparing base (0658b9f) to head (37de2dd).
Report is 11 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1593   +/-   ##
=======================================
  Coverage   95.69%   95.69%           
=======================================
  Files         101      101           
  Lines       26348    26348           
=======================================
  Hits        25215    25215           
  Misses       1133     1133           
Files with missing lines Coverage Δ
desc/basis.py 96.81% <100.00%> (ø)
desc/equilibrium/equilibrium.py 95.90% <100.00%> (ø)
desc/geometry/curve.py 96.63% <ø> (ø)
desc/geometry/surface.py 97.12% <100.00%> (ø)

... and 2 files with indirect coverage changes

@YigitElma YigitElma requested a review from f0uriest February 19, 2025 01:09
@YigitElma
Copy link
Collaborator

@dpanici

@YigitElma YigitElma added the easy Short and simple to code or review label Feb 19, 2025
@dpanici dpanici requested a review from a team February 21, 2025 19:33
@dpanici dpanici merged commit 3a98a23 into master Feb 21, 2025
25 checks passed
@dpanici dpanici deleted the dp/fix-eq-init-asym branch February 21, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy Short and simple to code or review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Asymmetric errors
3 participants